package app.web.admin.domain.pojo;

import app.core.ar.Ar;
import com.gitee.feizns.quickstart.ddl.annotation.Comment;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * 用户角色
 * @author feizns
 * @since 2025/3/11
 */
@Data
@Entity
@Comment("用户角色")
@EqualsAndHashCode(callSuper = true)
@Table(name = "admin_of_role")
@com.mybatisflex.annotation.Table(value = "admin_of_role", comment = "用户角色关联表")
public class AdminOfRole extends Ar<AdminOfRole> {

    /**
     * 管理员编号
     */
    @Comment("管理员编号")
    private Long adminId;

    /**
     * 角色编号
     */
    @Comment("角色编号")
    private Long roleId;

    /**
     * 构建指定用户的角色记录
     * @return {@link AdminOfRole }
     */
    public static AdminOfRole of(Long userId, Long roleId) {
        AdminOfRole adminOfRole = new AdminOfRole();
        adminOfRole.setAdminId(userId);
        adminOfRole.setRoleId(roleId);
        return adminOfRole;
    }

}
